﻿using UnityEngine;
using System.Collections;

public class UIManager : MonoBehaviour {

    public static UIManager _instance;
    public static UIManager Instance
    {
        get
        {
            return _instance;
        }
    }

    public UserData localUserData;

    private void Awake()
    {
        if (_instance == null)
            _instance = this;
        else
            Destroy(this.gameObject);
    }

    // Use this for initialization
    void Start () {
        GoPage("loginPanel");
    }
	
	public void GoPage(string panelName,params object[] param)
    {
        GameObject prefab = Resources.Load<GameObject>("UI/"+ panelName);
        GameObject go = Instantiate(prefab);
        go.transform.SetParent(transform, false);//UI必填

        //把数据传给页面
        go.GetComponent<PanelBase>().InitData(param);
    }
}
